package java5;

/**
 * @author draem
 * @create 2018-06-20 00:07
 */
public class  EnumerationTest {
    public static void main(String[] args) {
        //todo
        Color color =Color.Red;
        System.out.println(color.getColor());

        Color [] colors =Color.values();
        for (Color cl:colors){
            System.out.println(cl.ordinal()+"\t"+cl.name());

        }
    }

    //默认继承enum
    public enum  Color {
        Red("red") ,
        Yellow("yellow") ;

        private  String color;
        Color(String color){

            this.color=color;
        }

        public String getColor(){
            return  color;
        }






    }
//默认继承enmu，无法在继承其他类
    enum Fruit implements Fly{

        Apple{
            @Override
            public String getName() {
                return "apple";
            }
        };

    @Override
    public void fly() {
        System.out.println("我能飞");
    }

    //覆盖方法
    @Override
    public String toString() {
        return this.name;
    }
    private String name;
    public abstract  String getName();
    }

///EnumMap https://blog.csdn.net/javazejian/article/details/71333103



    interface  Fly{

        public void fly();
    }
}
